using System;
using Android.App;
using Android.OS;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;

using Toon.Models.Characters;
using Granite.Axml;

namespace Toon.Views
{
	[Activity(Label = "Toon", MainLauncher = true, Icon = "@drawable/icon")]
	public class HomeView : BindingActivity<PrimaryViewModel>
	{

		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);
			SetContentView(Resource.Layout.Home);

			BindText(Resource.Id.ExtraText, ViewModel, "CurrentRuleSet.Name", BindingMode.TwoWay);

			//var extraText = FindViewById<TextView>(Resource.Id.ExtraText);
			//extraText.Text = ViewModel.CurrentRuleSet.Name;

			FindViewById<Button>(Resource.Id.NewButton).Click += (sender, e) => ViewModel.CreateNew();
			FindViewById<Button>(Resource.Id.RandomButton).Click += (sender, e) => ViewModel.CreateRandom();

		}

		//protected override void OnCreate(Bundle bundle)
		//{
		//	base.OnCreate(bundle);
		//	var layout = new LinearLayout(this);
		//	layout.AddView(Resource.Layout.HomePart1);
		//	layout.AddView(Resource.Layout.HomePart2);
		//	SetContentView(layout);

		//	BindText(Resource.Id.ExtraText, ViewModel, "CurrentRuleSet.Name", BindingMode.TwoWay);

		//	//var extraText = FindViewById<TextView>(Resource.Id.ExtraText);
		//	//extraText.Text = ViewModel.CurrentRuleSet.Name;

		//	FindViewById<Button>(Resource.Id.NewButton).Click += (sender, e) => ViewModel.CreateNew();
		//	FindViewById<Button>(Resource.Id.RandomButton).Click += (sender, e) => ViewModel.CreateRandom();

		//}

	}
}
